/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.colegiatura.validator;

import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;

/**
 *
 * @author ADMINISTRADOR
 */
public class validarNulos implements Validator{

    public validarNulos() {
    }

    public void validate(FacesContext arg0, UIComponent arg1, Object arg2){

        String cadena = (String)arg2;
        
        if(cadena.length()<0){
          mostrarMensaje("Debe Ingresar datos...");

        }
    }

    public void mostrarMensaje(String detalle) {
        try {
            FacesMessage fm = new FacesMessage(detalle);
            FacesContext.getCurrentInstance().addMessage(fm.toString(),fm);
        } catch (Exception e) {
            FacesMessage fm = new FacesMessage(detalle);
            FacesContext.getCurrentInstance().addMessage(fm.toString(), fm);
        }
    }


}
